import type {App} from 'vue'
import pinia from '@/stores'
import {useUserInfoStore} from '@/stores/userInfo'


export default (app:App)=>{

    // app.directive('color', (el, binding) => {
    //     // 这会在 `mounted` 和 `updated` 时都调用
    //     el.style.color = binding.value
    // })
    const userInfoStore = useUserInfoStore()
    app.directive('has',{
        mounted(ele,bindings){
            let isExs=userInfoStore.userInfo.buttons.includes(bindings.value)
            // 拿到button里边的数据(即按钮权限的数据)
            if(!isExs){
                ele.parentNode.removeChild(ele)
            }
        }
    })
}